package com.glela.order.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.glela.order.model.OrderSettlement;
import com.glela.order.vo.OrderSettlementVo;

public interface OrderSettlementMapper {
    int deleteByPrimaryKey(Long id);

    int insert(OrderSettlement record);

    int insertSelective(OrderSettlement record);
    
    int batchInsert(List<OrderSettlement> list);

    OrderSettlement selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(OrderSettlement record);

    int updateByPrimaryKeyWithBLOBs(OrderSettlement record);

    int updateByPrimaryKey(OrderSettlement record);
    
    int updateStatusByID(@Param("ID") Long ID,@Param("status") int status
    		,@Param("settlementNo") String settlementNo,@Param("companyAccount") String companyAccount
    		,@Param("managerAccount") String managerAccount,@Param("selfSupport") int selfSupport);
    
    int updateStatusByOrderSn0(@Param("orderSn") String orderSn,@Param("status") int status
    		,@Param("settlementNo") String settlementNo);
    
    List<OrderSettlementVo> selectByOrderSnForSettlement(String orderSn);
    
    List<OrderSettlementVo> selectByOrderSnForSettlementDetail(String orderSn);
    
    List<OrderSettlementVo> selectByOrderSnForFreightSettlement(String orderSn);

    /** MaoZeYao **/
    /**
     * 根据父订单ID修改结算表的状态为已禁用
     * @param id
     * @return
     */
	int updateOrderSettlementStatusByOrderDetailId(Long orderDetailId);
	
	/**
	 * 根据订单想起获取
	 * @param orderDetailId
	 * @return
	 */
	OrderSettlement selectByOrderDetailId(Long orderDetailId);

	/**
	 * 查询邮费分账信息
	 * @param orderObjectId
	 * @return
	 */
	String selectSettlementAccount(Long orderObjectId);
	 
	/**
	* 在结算单中查询可分账的子单单号(商品是B区商品 同时结算单状态是启用状态)
	* @author gaoweiqi
	* @date 2017年8月19日 12:44:05
	**/
	public List<String> selectOrderOrderSettlementByStatus();
	
	public void updateOrderSettlementPortionMessage(@Param("settlementMan")String settlementMan,@Param("settlementAccount")String settlementAccount
			,@Param("settlementBank")String settlementBank,@Param("goodsType")int goodsType,@Param("settlementPriceDealer")int settlementPriceDealer
			,@Param("settlementPriceManager")int settlementPriceManager,@Param("cashCoinDealer")int cashCoinDealer,@Param("cashCoinManager")int cashCoinManager,
			@Param("settlementRateDealer")int settlementRateDealer,@Param("settlementRateManager")int settlementRateManager
			,@Param("id")long id);
	
	public Map<String,Object> selectOrderUserInfoById(@Param("settlementId") Long settlementId);
	
	int updateStatusBySettlementId(@Param("settlementId") Long settlementId,@Param("status") int status	,@Param("settlementNo") String settlementNo,@Param("companyAccount") String companyAccount
    		,@Param("managerAccount") String managerAccount);
		
	List<OrderSettlement> selectSettlementByOrderSn(@Param("orderSn") String orderSn);

	void updateByPrimaryKey2(@Param("id")Long id,@Param("code") int code,@Param("settlementNo") String settlementNo, 
			@Param("OBJ")OrderSettlement orderSettlement);
}